package com.seafood.service;

import com.seafood.dto.LocationAddressDTO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 地址管理服务接口
 */
public interface LocationAddressService {
    
    /**
     * 创建地址
     */
    LocationAddressDTO createAddress(LocationAddressDTO addressDTO);
    
    /**
     * 更新地址
     */
    LocationAddressDTO updateAddress(Long id, LocationAddressDTO addressDTO);
    
    /**
     * 根据ID获取地址
     */
    LocationAddressDTO getAddressById(Long id);
    
    /**
     * 根据业务ID和地址类型获取地址列表
     */
    List<LocationAddressDTO> getAddressesByBusiness(Long businessId, String addressType);
    
    /**
     * 获取用户的所有地址
     */
    List<LocationAddressDTO> getUserAddresses(Long businessId);
    
    /**
     * 根据地址类型分页获取地址
     */
    Page<LocationAddressDTO> getAddressesByType(String addressType, Pageable pageable);
    
    /**
     * 搜索地址
     */
    Page<LocationAddressDTO> searchAddresses(String keyword, Pageable pageable);
    
    /**
     * 获取默认地址
     */
    LocationAddressDTO getDefaultAddress(Long businessId, String addressType);
    
    /**
     * 设置默认地址
     */
    LocationAddressDTO setDefaultAddress(Long addressId, Long businessId, String addressType);
    
    /**
     * 查找附近的地址
     */
    List<LocationAddressDTO> findNearbyAddresses(BigDecimal latitude, BigDecimal longitude, 
                                                Double radiusKm, String addressType);
    
    /**
     * 根据坐标范围查找地址
     */
    List<LocationAddressDTO> findAddressesInRange(BigDecimal minLat, BigDecimal maxLat,
                                                  BigDecimal minLon, BigDecimal maxLon);
    
    /**
     * 验证地址并补全地理信息
     */
    LocationAddressDTO validateAndEnrichAddress(LocationAddressDTO addressDTO);
    
    /**
     * 删除地址（软删除）
     */
    void deleteAddress(Long id);
    
    /**
     * 批量删除地址
     */
    void deleteAddresses(List<Long> addressIds);
    
    /**
     * 激活/停用地址
     */
    LocationAddressDTO toggleAddressStatus(Long id, Boolean isActive);
    
    /**
     * 获取地址统计信息
     */
    Map<String, Object> getAddressStatistics();
    
    /**
     * 导入地址数据
     */
    List<LocationAddressDTO> importAddresses(List<LocationAddressDTO> addresses);
    
    /**
     * 导出地址数据
     */
    List<LocationAddressDTO> exportAddresses(String addressType, String province, String city);
    
    /**
     * 检查地址重复
     */
    List<LocationAddressDTO> checkDuplicateAddresses(BigDecimal latitude, BigDecimal longitude, Long excludeId);
}